<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); ?>

<?php if(!isset($_POST['id'])):?>
	<?php 
		$match_id = intval($_POST['match_id']);
		$MATCH = $this->match_entity->init('id', $match_id);	 
	?>	
	<form action="<?php echo site_url('admin/dataman/match/scorecard_submit_item');?>" name="scorecard_submit_item" id="scorecard_submit_item" method="post" enctype="multipart/form-data" >
		<input type="hidden" name="match_id" id="match_id" value="<?php echo $match_id;?>" />
		
		<div class="clrboth"></div>
		<div class="grid2"><b>Index:</b></div>
		<div class="grid4"><input type="text" maxlength="255" id="index" name="index" value="" style="width:185px;" /></div>
		<div class="clrboth"></div>
		 
		<div class="clrboth"></div>
		<div class="grid2"><b>Value:</b></div>
		<div class="grid4"><input type="text" maxlength="255" id="value" name="value" value="" style="width:185px;" /></div>
		<div class="clrboth"></div>
		
		<div class="grid2" style="margin-top:10px;">
			<input type="button" class="button" value="Save" onclick="return do_save_scorecard();" /> 
			<?php echo loader_image('id="loader_image" class="hidden"');?>
		</div>
		<div class="clrboth"></div>	
	</form>	
	
<?php else:?>
	<?php 
		$result = $this->db->where('id', intval($_POST['id']))->get(TBL_SCORECARD)->result();
	?>
	<form action="<?php echo site_url('admin/dataman/match/scorecard_submit_item');?>" name="scorecard_submit_item" id="scorecard_submit_item" method="post" enctype="multipart/form-data" >
		<input type="hidden" name="match_id" id="match_id" value="<?php echo $_POST['match_id'];?>" />
		<input type="hidden" name="id" id="id" value="<?php echo $result[0]->id;?>" />
		
		<div class="clrboth"></div>
		<div class="grid2"><b>Index:</b></div>
		<div class="grid4"><input type="text" maxlength="255" id="index" name="index" value="<?php echo $result[0]->over_index;?>" style="width:185px;" /></div>
		<div class="clrboth"></div>
		 
		<div class="clrboth"></div>
		<div class="grid2"><b>Value:</b></div>
		<div class="grid4"><input type="text" maxlength="255" id="value" name="value" value="<?php echo $result[0]->value;?>" style="width:185px;" /></div>
		<div class="clrboth"></div>
		
		<div class="grid2" style="margin-top:10px;">
			<input type="button" class="button" value="Save" onclick="return do_save_scorecard();" /> 
			<?php echo loader_image('id="loader_image" class="hidden"');?>
		</div>
		<div class="clrboth"></div>	
	</form>
	
<?php endif;?>
	